﻿using UnityEngine;
using System.Collections.Generic;
using TTGame;
using CinemaDirector;
using TTGameEngine;

/*
 * BulletTrigger
 * 抛物线子弹（轨迹是抛物线的）
 *
 * 使用BulletTrigger代替。
 *
 * 依赖：
 *
 * ！不写重复代码！
 * @author TTun
 * @date 7/29/2017 5:08:34 PM
 */

// [CutsceneItemAttribute("Bullet", "LT Parabola Bullet Trigger", CutsceneItemGenre.ActorItem)]
// public class ParabolaBulletTrigger : CinemaActorEvent {
//     public TargetTypeID m_targetType;
//     public MoveStrategy m_moveStrategy = MoveStrategy.Dir_CasterFace;
//
//     //public int AffectObjCount = 0; //可作用人数
//     public float m_bulletLifeTime;       //子弹的持续时间
//     public string bulletPrefab = "";
//     public string shootPosAtObjPos = "";   //发射口位置
//     public string muzzlePosName = "";
//     [Tooltip("二级子弹Prefab")]
//     public string followUpBulletPrefab = "";
//     [Tooltip("不造成伤害")]
//     public bool isNoHarm = false;
//
//     List<Puppet> tmpObjs = new List<Puppet>();
//
//     public override void Trigger(GameObject actor) {
// #if UNITY_EDITOR
//         if(Application.isPlaying == false) {
//             return;
//         }
// #endif
//         ParabolaBullet bullet = MagicBallManager.Share().CreateMBWithPrefab(bulletPrefab) as ParabolaBullet;
//
//         if(bullet == null) {
//             DebugUtil.LogErrorFormat("[ParabolaBulletTrigger] 子弹预设填的不对. obj:[{0}]", actor.name);
//             return;
//         }
//
//         Puppet obj = actor.GetComponent<Puppet>();
//         SkillTL skill = this.GetSkill();
//         Transform casterTF = actor.transform;
//         Transform shootPosTF = obj.GetPosTF(shootPosAtObjPos);
//         if(shootPosTF == null) {
//             DebugUtil.LogErrorFormat("[ParabolaBulletTrigger] shootPosTF[{0}] set Error!", shootPosAtObjPos, muzzlePosName);
//             return;
//         }
//         skill.RegistBulletLogicHandler(bullet);
//         skill.BulletCount -= bullet.m_bulletConsume;
//
//         bullet.Init(obj, skill.SkillCastID, m_bulletLifeTime, m_targetType);
//         ParabolaMoveInfo moveInfo = bullet.MoveInfo;
//         Tools.SetMoveInfoOneTarget(moveInfo, m_moveStrategy, bullet.GetMoveSpeed(), skill, muzzlePosName);
//         moveInfo.moveTargetPos = skill.m_selector.ResultHitCenter;
//         bullet.SetIsNoHarm(isNoHarm);
//         bullet.SetMaxColliderCount(skill.m_skillData.maxHitTarget);
//         bullet.SetFollowUpBullet(followUpBulletPrefab, skill.SkillLogicHandler);
//         bullet.AddBuff(skill.SkillLogicHandler.BuffIDs);
//         bullet.EmitSelf(shootPosTF.position);
//     }
//
//     void OnDrawGizmos() {
//         if(Application.isPlaying == false) {
//             //Tools.DrawColliderInfo(transform, m_colliderInfo);
//         }
//     }
//
// }
//
